package fr.charlott.batch.writer;

import java.util.List;

import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;

import fr.charlott.core.repository.model.Categorie;
import fr.charlott.core.service.CategorieService;

public class CategorieWriter implements ItemWriter<Categorie>{

	@Autowired
	private CategorieService categorieService;

	@Override
	public void write(List<? extends Categorie> items) throws Exception {
		for (Categorie categorie : items) {
			categorieService.ajouterCategorie(categorie);
		}
	}

	public void setCategorieService(CategorieService categorieService) {
		this.categorieService = categorieService;
	}
}
